import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class SingleTonSafe {




    public static void main(String[] args) {

        Test test = new Test();
        List<Integer> list = new ArrayList<>();
        Integer i = 0;

        new Thread(()->{
            test.check();
        },"A").start();

        new Thread(()->{
            test.check();
        },"B").start();

        System.out.println("finish");
    }

}

class Test{

    public void check(){
        List<String> i = new ArrayList<>();
        for (int j = 0; j < 10000; j++) {
            i.add(UUID.randomUUID().toString());
        }
        System.out.println(Thread.currentThread().getName() + " " + i.size());
        System.out.println(i.hashCode());
    }

}
